package comp4081.servlet;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;





public class XmlServlet extends HttpServlet {
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		System.out.println("doGet from XML servlet called!");
		PrintWriter pw = response.getWriter();
		pw.println("this is XML serverlet");
		/*String userName = request.getParameter("userName");
		String id = request.getParameter("id");
		pw.println("Hello, " + userName + "!");
		pw.println("Your password: " + id);*/
		//doPost(request, response);
		response.setContentType("text/html");
		System.out.println("doGet from XML servlet called!");
		//PrintWriter pw = response.getWriter();
		pw.println("this is XML serverlet");
		String fName = request.getParameter("fName");
		String lName = request.getParameter("lName");
		String address = request.getParameter("address");
		String tel = request.getParameter("tel");
		pw.println("fName: " + fName);
		pw.println("lName: " + lName);
		pw.println("address: " + address);
		pw.println("tel: " + tel);
		//HibernateUtil.storeCustomer(fName, lName, address, tel);
	}
	
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		/*response.setContentType("text/html");
		System.out.println("doPost from XML servlet called!");
		PrintWriter pw = response.getWriter();
		pw.println("this is XML serverlet");
		String fName = request.getParameter("fName");
		String lName = request.getParameter("lName");
		String address = request.getParameter("address");
		String tel = request.getParameter("tel");
		pw.println("fName: " + fName);
		pw.println("lName: " + lName);
		pw.println("address: " + address);
		pw.println("tel: " + tel);*/
		//HibernateUtil.storeCustomer(fName, lName, address, tel);
		doGet(request, response);
	}
}